import Vue from "vue";
const _this = Vue.prototype;

const state = {
    userInfo: {} // 用户信息
};
const getters = {
    userName(state) {
        return state.userInfo.userName;
    }
};
const actions = {
    // 提交异步操作
    // 获取用户信息
    async getUserInfo({ commit }) {
        let res = await _this.$Geting(_this.$api.getUserInfo);
        if (res.code === "0") {
            commit("setUserInfo", res.data);
        }
    }
};
const mutations = {
    // 提交同步操作
    setUserInfo(state, playLoad) {
        state.userInfo = { ...playLoad };
    }
};
export default {
    state,
    getters,
    actions,
    mutations
};
